(function () {
    var exports = this;
    var $ = null;

    var RechargeHp_add = 'add';
    var RechargeHp_subtract = 'subtract';
    var RechargeHp_reset = 'reset';

    var unSelectTableView = cc.Layer.extend({
        ctor: function (data, parentLayer) {
            this._super();
            this._data = _.clone(data) || [];
            this._parentLayer = parentLayer;
            this._cellHeight = 95;
            this._tableViewHeight = 400;

            this.initUI();
        },
        initUI: function () {
            var tableViewUn = new cc.TableView(this, cc.size(560, this._tableViewHeight));
            tableViewUn.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL);
            tableViewUn.setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN);
            tableViewUn.setPosition(cc.p(0, 0));
            tableViewUn.setAnchorPoint(cc.p(0, 0));
            tableViewUn.setDelegate(this);
            this.addChild(tableViewUn);
            tableViewUn.retain();
            tableViewUn.reloadData();
            this._tableViewUn = tableViewUn;
        },
        reloadTa: function (data, addIdx) {
            var that = this;
            this._data = _.clone(data);

            if (this._tableViewUn) {
                this._tableViewUn.reloadData();
            }
            if (addIdx >= 0) {
                var tCellMaxNum = Math.ceil(that._tableViewHeight / that._cellHeight);
                if (that._data.length <= tCellMaxNum) {
                    that._tableViewUn.setContentOffset(cc.p(0, -that._data.length * that._cellHeight + that._tableViewHeight));
                } else {
                    that._tableViewUn.setContentOffset(cc.p(0, -that._data.length * that._cellHeight + that._tableViewHeight));
                }
            }
        },
        tableCellTouched: function (table, cell) {
        },
        tableCellAtIndex: function (table, idx) {
            var that = this;
            var cell = table.dequeueCell();
            if (cell == null) {
                cell = new cc.TableViewCell();
                var scenetmp = ccs.load(res.ClubPowerManageItem_json, 'modules/main/club/res/');
                scenetmp.node.setPosition(cc.p(560 / 2, 91 / 2));
                scenetmp.node.setName('node');
                cell.addChild(scenetmp.node);
            }
            var node = cell.getChildByName('node');
            var nickname = node.getChildByName('nickname');
            var tili = node.getChildByName('tili');
            var id = node.getChildByName('id');
            var head = node.getChildByName('head');
            var btn_xz = node.getChildByName('btn_xz');
            var btn_cx = node.getChildByName('btn_cx');
            var btn_plus = node.getChildByName('btn_plus');
            var btn_add = node.getChildByName('btn_add');

            btn_cx.setVisible(false);
            btn_xz.setVisible(true);
            btn_plus.setVisible(true);
            btn_add.setVisible(true);
            nickname.string = '' + (ellipsisStr(this._data[idx]['name'], 6));
            id.string = 'ID:' + (this._data[idx]['uid']);
            tili.string = '' + (this._data[idx]['hp'] || 0);
            loadImageToSprite(this._data[idx]['head'], head);
            TouchUtil.setOnclickListener(btn_plus, function () {
                var callback = function(num){
                    that._parentLayer.changePowerFunc(num, that._data[idx]['uid'], RechargeHp_subtract)
                }
                that._parentLayer.addChild(new ClubInputLayer('changePower', null, callback));
            }, {swallowTouches: false});
            TouchUtil.setOnclickListener(btn_add, function () {
                var callback = function(num){
                    that._parentLayer.changePowerFunc(num, that._data[idx]['uid'], RechargeHp_add)
                }
                that._parentLayer.addChild(new ClubInputLayer('changePower', null, callback));
            }, {swallowTouches: false});
            TouchUtil.setOnclickListener(btn_xz, function () {
                var delLast = (idx == that._data.length - 1);
                if (that._parentLayer) {
                    that._parentLayer.addSelect(that._data[idx]);
                }
                that._data.splice(idx, 1);
                that._tableViewUn.reloadData();

                var tCellMaxNum = Math.ceil(that._tableViewHeight / that._cellHeight);
                if (that._data.length <= tCellMaxNum) {
                    that._tableViewUn.setContentOffset(cc.p(0, -that._data.length * that._cellHeight + that._tableViewHeight));
                } else {
                    var moveidx = (idx == 0) ? idx : (idx - 1);
                    if (idx > (that._data.length - tCellMaxNum)) {
                        moveidx = that._data.length - tCellMaxNum + 1;
                    }
                    that._tableViewUn.setContentOffset(cc.p(0, -(that._data.length - moveidx) * that._cellHeight + that._tableViewHeight));
                }
            }, {swallowTouches: false});

            return cell;
        },
        tableCellSizeForIndex: function (table, idx) {
            return cc.size(560, this._cellHeight);
        },
        numberOfCellsInTableView: function (table) {
            return this._data.length;
        }
    });
    var SelectTableView = cc.Layer.extend({
        ctor: function (data, parentLayer) {
            this._super();
            this._data = _.clone(data) || [];
            this._parentLayer = parentLayer;
            this._cellHeight = 95;
            this._tableViewHeight = 400;

            this.initUI();
        },
        initUI: function () {
            var tableView = new cc.TableView(this, cc.size(560, this._tableViewHeight));
            tableView.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL);
            tableView.setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN);
            tableView.setPosition(cc.p(0, 0));
            tableView.setAnchorPoint(cc.p(0, 0));
            tableView.setDelegate(this);
            this.addChild(tableView);
            tableView.retain();
            tableView.reloadData();
            this._tableView = tableView;
        },
        reloadTa: function (data, addIdx) {
            var that = this;
            this._data = _.clone(data);

            if (this._tableView) {
                this._tableView.reloadData();
            }
            if (addIdx >= 0) {
                var tCellMaxNum = Math.ceil(that._tableViewHeight / that._cellHeight);
                if (that._data.length <= tCellMaxNum) {
                    that._tableView.setContentOffset(cc.p(0, -that._data.length * that._cellHeight + that._tableViewHeight));
                } else {
                    that._tableView.setContentOffset(cc.p(0, -that._data.length * that._cellHeight + that._tableViewHeight));
                }
            }
        },
        tableCellTouched: function (table, cell) {
        },
        tableCellAtIndex: function (table, idx) {
            var that = this;
            var cell = table.dequeueCell();
            if (cell == null) {
                cell = new cc.TableViewCell();
                var scenetmp = ccs.load(res.ClubPowerManageItem_json, 'modules/main/club/res/');
                scenetmp.node.setPosition(cc.p(560 / 2, 91 / 2));
                scenetmp.node.setName('node');
                cell.addChild(scenetmp.node);
            }
            var node = cell.getChildByName('node');
            var nickname = node.getChildByName('nickname');
            var id = node.getChildByName('id');
            var tili = node.getChildByName('tili');
            var head = node.getChildByName('head');
            var btn_xz = node.getChildByName('btn_xz');
            var btn_cx = node.getChildByName('btn_cx');
            var btn_plus = node.getChildByName('btn_plus');
            var btn_add = node.getChildByName('btn_add');

            btn_xz.setVisible(false);
            btn_cx.setVisible(true);
            btn_plus.setVisible(false);
            btn_add.setVisible(false);
            nickname.string = '' + (ellipsisStr(this._data[idx]['name'], 6));
            id.string = 'ID:' + (this._data[idx]['uid']);
            tili.string = '' + (this._data[idx]['hp'] || 0);
            loadImageToSprite(this._data[idx]['head'], head);
            TouchUtil.setOnclickListener(btn_cx, function () {
                if (that._parentLayer) {
                    that._parentLayer.addUnSelect(that._data[idx]);
                }

                that._data.splice(idx, 1);
                that._tableView.reloadData();
                that._parentLayer.setXiugaiRenshu(that._data.length);

                var tCellMaxNum = Math.ceil(that._tableViewHeight / that._cellHeight);
                if (that._data.length <= tCellMaxNum) {
                    that._tableView.setContentOffset(cc.p(0, -that._data.length * that._cellHeight + that._tableViewHeight));
                } else {
                    var moveidx = (idx == 0) ? idx : (idx - 1);
                    if (idx > (that._data.length - tCellMaxNum)) {
                        moveidx = that._data.length - tCellMaxNum + 1;
                    }
                    that._tableView.setContentOffset(cc.p(0, -(that._data.length - moveidx) * that._cellHeight + that._tableViewHeight));
                }
            }, {swallowTouches: false});
            return cell;
        },
        tableCellSizeForIndex: function (table, idx) {
            return cc.size(400, this._cellHeight);
        },
        numberOfCellsInTableView: function (table) {
            return this._data.length;
        }
    });

    /*
     开关界面
     */
    var ClubPowerSwitch = cc.Layer.extend({
        ctor: function (club_id, hp_stats) {
            this._super();
            var that = this;

            this._powerOpen = (hp_stats == 'up');

            loadNodeCCS(res.ClubPowerSwitch_json, this);
            this._$ = create$(this.getChildByName('Node'));

            this._$('bg.chk_open').setSelected(this._powerOpen);
            this._$('bg.chk_close').setSelected(!this._powerOpen);

            TouchUtil.setOnclickListener(this._$('bg.btn_close'), function () {
                that.removeFromParent();
            });
            TouchUtil.setOnclickListener(this._$('bg.btn_ok'), function () {
                if (that._powerOpen) {
                    network.send(2103, {cmd: 'SetClubHpStats', club_id: club_id, hp_stats: 'up'});
                } else {
                    network.send(2103, {cmd: 'SetClubHpStats', club_id: club_id, hp_stats: 'down'});
                }
                that.removeFromParent();
            });
            TouchUtil.setOnclickListener(this._$('bg.open'), function () {
                that._powerOpen = true;
                that._$('bg.chk_open').setSelected(that._powerOpen);
                that._$('bg.chk_close').setSelected(!that._powerOpen);
            });
            TouchUtil.setOnclickListener(this._$('bg.close'), function () {
                that._powerOpen = false;
                that._$('bg.chk_open').setSelected(that._powerOpen);
                that._$('bg.chk_close').setSelected(!that._powerOpen);
            });

            return true;
        },
    });


    /*
     主界面
     */
    var ClubPowerManageLayer = cc.Layer.extend({
        ctor: function (clubid) {
            this._super();
            var that = this;
            this._clubid = clubid;
            this._RechargeHp_type = RechargeHp_reset;

            loadNodeCCS(res.ClubPowerManageLayer_json, this);
            $ = create$(this.getChildByName('Node'));

            var clubInfo = ClubDataManager.getClubData(this._clubid);
            this._clubInfo = clubInfo;

            //刷新俱乐部成员
            if (clubInfo.players_count >= 200) {
                var cmd = '/club?cmd=ClubDetail&uid=' + gameData.uid
                    + '&club_id=' + this._clubid
                    + '&area=' + app.clubArea
                    + '&time=' + new Date().getTime();
                var sign = '&sign=' + Crypto.MD5('request:' + cmd);

                showLoading('加载中...');
                http.get('http://club.yygameapi.com:18800' + cmd + sign,
                    //测试地址 能返回测试数据
                    function (response) {
                        hideLoading();
                        //修改服务器返回数据 变为正常消息数据
                        var data = JSON.parse(response);
                        data.code = 2103;
                        data.data.command = 'flushClub';
                        // console.log("打印数组长度 " + data.data.info.members.length);
                        network.recv(data);

                        var clubInfo = ClubDataManager.getClubData(that._clubid);
                        that._clubInfo = clubInfo;
                        that._initData();
                    }, function (response) {
                        hideLoading();
                        showAlert('抱歉，系统繁忙！', 'noAnimation');
                    }
                );
            } else {
                this._initData();
            }
            return true;
        },
        _initData: function () {
            var that = this;

            var clubMembersInfo = this._clubInfo['members'];
            that._clubMembersInfo = clubMembersInfo;
            that._setHp(this._clubInfo['hp_value'], this._clubInfo['members']);

            that.unArr = _.clone(clubMembersInfo);
            var paixuType = cc.sys.localStorage.getItem('paixuType') || 1;
            paixuType = parseInt(paixuType);
            if (paixuType == 2) {
                this.unArr.sort(function (a, b) {
                    return a.hp - b.hp;
                });
            } else {
                this.unArr.sort(function (a, b) {
                    return b.hp - a.hp;
                });
            }

            that.selectArr = [];

            that.initUI();
        },
        _setHp: function (hp_value, members) {
            var that = this;
            if (hp_value) {
                var getHp = function (uid) {
                    for (var i = 0; i < hp_value.length; i++) {
                        if (hp_value[i]['uid'] == uid) {
                            var hp = hp_value[i]['hp'].toFixed(1);
                            return hp;
                        }
                    }
                    return 0;
                };
                for (var i = 0; i < members.length; i++) {
                    members[i]['hp'] = getHp(members[i]['uid']) || 0;
                }
            }
        },
        onEnter: function () {
            cc.Layer.prototype.onEnter.call(this);
            var that = this;
            this.list1 = cc.eventManager.addCustomListener('RechargeHp', function (event) {
                var data = event.getUserData();
                if (data.result >= 0) {
                    if (data.result == 0) {
                        showAlert('修改成功');
                    } else {
                        showAlert(data.msg || '修改失败');
                    }
                } else {
                    that._setHp(data['hp_value'], that.selectArr);
                    that._setHp(data['hp_value'], that.unArr);
                    that.SelectLayer.reloadTa(that.selectArr);
                    that.unSelectLayer.reloadTa(that.unArr);
                }
            });
            this.list2 = cc.eventManager.addCustomListener('SetClubHpStats', function (event) {
                var data = event.getUserData();
                if (data.result >= 0) {
                    if (data.result == 0) {
                        showAlert('修改成功');
                    } else {
                        showAlert(data.msg || '修改失败');
                    }
                } else {
                    that.setOpenStatus(data['hp_stats']);
                }
            });
        },
        onExit: function () {
            cc.Layer.prototype.onExit.call(this);
            cc.eventManager.removeListener(this.list1);
            cc.eventManager.removeListener(this.list2);
        },
        initUI: function () {
            var that = this;
            var unSelectLayer = new unSelectTableView(_.clone(this.unArr), this);
            this.unSelectLayer = unSelectLayer;
            $('root.bg_un.scroll').addChild(unSelectLayer, 2);

            var SelectLayer = new SelectTableView(_.clone(this.selectArr), this);
            this.SelectLayer = SelectLayer;
            $('root.bg_select.scroll').addChild(SelectLayer, 2);


            $('root.txt_status').setString('开关状态：' + (this._clubInfo['hp_stats'] == 'up' ? '开启中' : '关闭中'));

            this.setXiugaiRenshu(0);
            $('root.btn_kg').setVisible(gameData.uid == this._clubInfo['owner_uid']);
            TouchUtil.setOnclickListener($('root.btn_kg'), function () {
                var hp_stats = that._clubInfo['hp_stats'];
                that.addChild(new ClubPowerSwitch(that._clubid, hp_stats));
            });
            TouchUtil.setOnclickListener($('root.btn_close'), function () {
                that.removeFromParent();
            });
            TouchUtil.setOnclickListener($('root.btn_xgjl'), function () {
                if (that._clubInfo['hp_stats'] != 'up') {
                    showAlert('体力值系统未开启，请先开启');
                    return;
                }
                that.addChild(new ClubPowerListLayer(that._clubid));
            });
            //确认修改
            TouchUtil.setOnclickListener($('root.btn_qrxg'), function () {
            });

            //全选
            TouchUtil.setOnclickListener($('root.bg_un.btn_qx'), function () {
                var input = that.getChildByName('input');
                input.setString('');

                that.selectArr = _.clone(that._clubMembersInfo);
                that.unArr = [];
                that.unSelectLayer.reloadTa(that.unArr);
                that.setXiugaiRenshu(that.selectArr.length);
                that.SelectLayer.reloadTa(that.selectArr);
            });
            //升序排列  btn_up
            TouchUtil.setOnclickListener($('root.bg_un.btn_up'), function () {
                var paixuType = cc.sys.localStorage.getItem('paixuType') || 1;
                paixuType = parseInt(paixuType);

                // that.unArr = _.clone(that._clubMembersInfo);
                if (that.unArr && that.unArr.length > 0) {
                    paixuType = (paixuType == 1 ? 2 : 1);
                    if (paixuType == 2) {
                        that.unArr.sort(function (a, b) {
                            return a.hp - b.hp;
                        });
                    } else {
                        that.unArr.sort(function (a, b) {
                            return b.hp - a.hp;
                        });
                    }
                    that.unSelectLayer.reloadTa(that.unArr);
                    cc.sys.localStorage.setItem('paixuType', paixuType);
                }
            });
            //全撤销
            TouchUtil.setOnclickListener($('root.bg_select.btn_qc'), function () {
                var inputun = that.getChildByName('inputun');
                inputun.setString('');

                that.selectArr = [];
                that.unArr = _.clone(that._clubMembersInfo);
                var paixuType = cc.sys.localStorage.getItem('paixuType') || 1;
                paixuType = parseInt(paixuType);
                if (paixuType == 2) {
                    that.unArr.sort(function (a, b) {
                        return a.hp - b.hp;
                    });
                } else {
                    that.unArr.sort(function (a, b) {
                        return b.hp - a.hp;
                    });
                }
                that.unSelectLayer.reloadTa(that.unArr);
                that.setXiugaiRenshu(that.selectArr.length);
                that.SelectLayer.reloadTa(that.selectArr);
            });
            var inputun = new cc.EditBox(cc.size(380, 40),
                new cc.Scale9Sprite(club.res.transparent_64x64_png));
            this.addChild(inputun);
            inputun.setName('inputun');
            var pos1 = $('root.bg_un.searchbg').convertToWorldSpace(cc.p(0, 0));
            var size1 = $('root.bg_un.searchbg').getContentSize();
            inputun.setPosition(cc.p(pos1.x + size1.width / 2 + 30,
                pos1.y + size1.height / 2));
            inputun.setFontColor(cc.color(255, 255, 255));
            inputun.setPlaceholderFontColor(cc.color(175, 133, 108));
            inputun.setDelegate(this);
            inputun.setMaxLength(20);
            inputun.setFontSize(28);
            inputun.setPlaceholderFontSize(28);
            inputun.setPlaceHolder('输入昵称或者ID搜索');

            var input = new cc.EditBox(cc.size(380, 40),
                new cc.Scale9Sprite(club.res.transparent_64x64_png));
            this.addChild(input);
            input.setName('input');
            var pos2 = $('root.bg_select.searchbg').convertToWorldSpace(cc.p(0, 0));
            var size2 = $('root.bg_select.searchbg').getContentSize();
            input.setPosition(cc.p(pos2.x + size2.width / 2 + 30,
                pos2.y + size2.height / 2));
            input.setFontColor(cc.color(255, 255, 255));
            input.setPlaceholderFontColor(cc.color(175, 133, 108));
            input.setDelegate(this);
            input.setMaxLength(20);
            input.setFontSize(28);
            input.setPlaceholderFontSize(28);
            input.setPlaceHolder('输入昵称或者ID搜索');

            // var changebgtxt = new cc.EditBox(cc.size(220, 50),
            //     new cc.Scale9Sprite('res/submodules/club/transparent/transparent_64x64.png'));
            // this.addChild(changebgtxt);
            // changebgtxt.setName('powerChangeTxt');
            // var pos3 = $('root.idbg').convertToWorldSpace(cc.p(0, 0));
            // var size3 = $('root.idbg').getContentSize();
            // changebgtxt.setPosition(cc.p(pos3.x + size3.width / 2,
            //     pos3.y + size3.height / 2));
            // changebgtxt.setFontColor(cc.color(255, 255, 255));
            // changebgtxt.setPlaceholderFontColor(cc.color(175, 133, 108));
            // changebgtxt.setDelegate(this);
            // changebgtxt.setMaxLength(6);
            // changebgtxt.setFontSize(28);
            // changebgtxt.setPlaceholderFontSize(28);
            // changebgtxt.setPlaceHolder('输入要修改的值');
            TouchUtil.setOnclickListener($('root.idbg'), function () {
                var callback = function (num) {
                    that.changePowerFunc(num)
                }
                that.addChild(new ClubInputLayer('changePower', null, callback));
            });

            //
            $('root.changebg.bg').setVisible(false);
            TouchUtil.setOnclickListener($('root.changebg'), function () {
                $('root.changebg.bg').setVisible(!$('root.changebg.bg').isVisible());
            });
            TouchUtil.setOnclickListener($('root.changebg.bg'), function () {
                $('root.changebg.bg').setVisible(false);
            });
            TouchUtil.setOnclickListener($('root.changebg.bg.bg.txt_0'), function () {
                $('root.changebg.txt').setString('增加');
                that._RechargeHp_type = RechargeHp_add;
                $('root.changebg.bg').setVisible(false);
            });
            TouchUtil.setOnclickListener($('root.changebg.bg.bg.txt_1'), function () {
                $('root.changebg.txt').setString('减少');
                that._RechargeHp_type = RechargeHp_subtract;
                $('root.changebg.bg').setVisible(false);
            });
            TouchUtil.setOnclickListener($('root.changebg.bg.bg.txt_2'), function () {
                $('root.changebg.txt').setString('重置');
                that._RechargeHp_type = RechargeHp_reset;
                $('root.changebg.bg').setVisible(false);
            });
        },
        changePowerFunc: function (tilinum, uid, addtype) {
            var that = this;
            $('root.idbg.txt').setString(tilinum);
            if (that._clubInfo['hp_stats'] != 'up') {
                showAlert('体力值系统未开启，请先开启');
                return;
            }
            if (tilinum == null || tilinum == undefined || tilinum == '') {
                showAlert('未输入要修改的体力值');
                return;
            }
            tilinum = parseInt(tilinum);
            if ((that.selectArr && that.selectArr.length > 0) || uid) {
                var uids = [];
                if(uid){
                    uids.push(uid);
                }else {
                    for (var i = 0; i < that.selectArr.length; i++) {
                        uids.push(that.selectArr[i].uid);
                    }
                }
                network.send(2103, {
                    cmd: 'RechargeHp',
                    changetype: addtype || that._RechargeHp_type,
                    club_id: that._clubid,
                    uids: uids,
                    value: tilinum
                });
            } else {
                showAlert('未选择要修改的人');
            }
        },
        /*
         EditBox
         */
        editBoxEditingDidBegin: function (editBox) {
        },
        editBoxEditingDidEnd: function (editBox) {
        },
        editBoxTextChanged: function (editBox, text) {
            var that = this;
            var name = editBox.getName();
            if (name == 'inputun') {
                that.setUnData(editBox.getString());
            } else if (name == 'input') {
                that.setSelectData(editBox.getString());
            }
        },
        editBoxReturn: function (editBox) {
        },

        setOpenStatus: function (hp_stats) {
            this._clubInfo['hp_stats'] = hp_stats;
            $('root.txt_status').setString('开关状态：' + (hp_stats == 'up' ? '开启中' : '关闭中'));
        },
        addSelect: function (uinfo) {
            var input = this.getChildByName('input');
            input.setString('');

            var index = -1;
            if (this.unArr && uinfo) {
                for (var i = 0; i < this.unArr.length; i++) {
                    if (this.unArr[i].uid == uinfo.uid) {
                        this.unArr.splice(i, 1);
                        index = i;
                        break;
                    }
                }
            }
            if (this.selectArr) {
                for (var i = this.selectArr.length - 1; i >= 0; i--) {
                    this.selectArr[i + 1] = this.selectArr[i];
                }
                this.selectArr[0] = uinfo;
            }
            this.setXiugaiRenshu(this.selectArr.length);
            this.SelectLayer.reloadTa(this.selectArr, index);
        },
        addUnSelect: function (uinfo) {
            var inputun = this.getChildByName('inputun');
            inputun.setString('');

            var index = -1;
            if (this.selectArr && uinfo) {
                for (var i = 0; i < this.selectArr.length; i++) {
                    if (this.selectArr[i].uid == uinfo.uid) {
                        this.selectArr.splice(i, 1);
                        index = i;
                        break;
                    }
                }
            }
            if (this.unArr) {
                for (var i = this.unArr.length - 1; i >= 0; i--) {
                    this.unArr[i + 1] = this.unArr[i];
                }
                this.unArr[0] = uinfo;
            }
            this.unSelectLayer.reloadTa(this.unArr, index);
        },
        //根据 id 昵称 筛选成员列表
        setUnData: function (txt) {
            var tt = _.clone(this.unArr);
            var tmpArr = this.getSearchNameID(tt, txt);
            this.unSelectLayer.reloadTa(tmpArr);
        },
        //根据 id 昵称 筛选选择列表
        setSelectData: function (txt) {
            var tt = _.clone(this.selectArr);
            var tmpArr = this.getSearchNameID(tt, txt);
            this.SelectLayer.reloadTa(tmpArr);
        },
        getSearchNameID: function (arr, txt) {
            var tmp = [];
            for (var i = 0; i < arr.length; i++) {
                var nickname = '' + arr[i]['name'];
                var uid = '' + arr[i]['uid'];
                if (nickname.indexOf(txt) >= 0 || uid.indexOf(txt) >= 0) {
                    tmp.push(arr[i]);
                }
            }
            return tmp;
        },
        setXiugaiRenshu: function (num) {
            $('root.txt_renshu').setString(num);
        }
    });

    exports.ClubPowerManageLayer = ClubPowerManageLayer;
})(window);



